from django.db import models
from django.contrib.auth.models import User
from bitfield import BitField

class Colors(models.Model):
    color = models.CharField(db_column='Color', max_length=30, blank=True, null=True)  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'colors'

class Types(models.Model):
    type = models.CharField(db_column='Type', max_length=30, blank=True, null=True)  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'types'

class Tasks(models.Model):
    tname = models.CharField(db_column='TName', max_length=30, blank=True, null=False)
    descr = models.CharField(db_column='Descr', max_length=255, blank=True, null=True)
    datet = models.DateField(db_column='DateT')  # Field name made lowercase.
    timet = models.TimeField(db_column='TimeT')  # Field name made lowercase.
    color = models.ForeignKey(Colors, on_delete = models.CASCADE)
    reminder = models.BooleanField(db_column='Reminder')  # Field name made lowercase. This field type is a guess.
    type = models.ForeignKey(Types, models.DO_NOTHING, db_column='Type_id')  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'tasks'


class Userparams(models.Model):
    telegr = models.CharField(max_length=30, blank=True, null=True)
    user = models.ForeignKey(User, models.DO_NOTHING, db_column='User_id')  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'userparams'


class User_Task(models.Model):
    user = models.ForeignKey(User, models.DO_NOTHING, db_column='User_id')
    task = models.ForeignKey('Tasks', models.DO_NOTHING, db_column='Task_id')
    class Meta:
        managed = False
        db_table = 'user_task'
# Create your models here.s
